<template>
	<view class="cttit">
		<text>反馈记录</text>
		<view class=""></view>
	</view>
	<view class="listbg" v-if="list.length">
		<view class="listitem" @click="goinletter(index)" v-for="(item,index) in list" :key="index">
			<text>意见反馈</text>
			<view class=""><text>{{item.details}}</text><text>{{item.createTime}}</text> </view>
		</view>
	</view>
	<view class="" style="padding-top: 120rpx;" v-else>
		<up-empty mode="message" text="暂无记录">
		</up-empty>
	</view>
</template>



<script setup>
	import {
		ref,
		onMounted
	} from 'vue';
	import { feedbackList } from "@/api/index.js"
	import {
		onReachBottom
	} from '@dcloudio/uni-app';
	onReachBottom(() => {
		page.value++
		getList()
	})
	onMounted(() => {
		getList()
	})
	
	
	
	
	let list = ref([])

	let page = ref(1)

	function getList() {

		let data = {
			pageSize: 10,
			pageNum: page.value
		}
		feedbackList(data).then(res => {
			if (page.value == 1) {
				list.value = res.rows
			} else {
				if (res.rows.length == 0) {
					uni.showToast({
						title: "暂无更多数据~",
						icon: "none"
					})
					page.value--
					return
				} else {
					list.value = [...list.value, ...res.rows]

				}


			}
		})

	}

	function goinletter(index) {


		let info = list.value[index]
		uni.navigateTo({
			url: "/pages/mine/fankui/submit?info="+JSON.stringify(info)
		})
	}
</script>




<style lang="scss">
	.cttit {
		margin-top: 36rpx;
		margin-left: 30rpx;
		position: relative;
		display: flex;
		flex-direction: column;
	
		&>text {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #111111;
			line-height: 24rpx;
			position: relative;
			z-index: 10;
		}
	
		view {
			width: 130rpx;
			height: 16rpx;
			border-radius: 20rpx;
			background: #C7A46F;
			position: absolute;
			bottom: -6rpx;
		}
	}
	.listbg {

		width: 100%;
		overflow: hidden;

		.listitem {
			box-sizing: border-box;
			padding: 30rpx;
			margin-top: 24rpx;
			width: 690rpx;
			margin-left: 30rpx;
			background: #ffffff;
			border-radius: 16rpx 16rpx 16rpx 16rpx;

			text {
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #000000;
			}

			view {
				margin-top: 18rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				text {
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 26rpx;
					color: #777777;
				}

				text:nth-of-type(1) {
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 26rpx;
					color: #777777;
					display: block;
					width: 360rpx;
					text-overflow: ellipsis;
					white-space: nowrap;
					overflow: hidden;
				}
				text:nth-of-type(2) {
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 22rpx;
					color: #AAAAAA;
				}
			}
		}
	}
</style>